package com.jsc.controller;

import cn.com.xib.sm.utils.SM2Util;
import org.junit.jupiter.api.Test;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

public class luck {

    public static List<String> candy = new ArrayList<String>();
    public static List<String> child1 = new ArrayList<String>();
    public static List<String> child2 = new ArrayList<String>();

    // 2：3：5
    @Test
    public void cmain() {

        candy.add("糖果1");
        candy.add("糖果2");
        candy.add("糖果3");
        candy.add("糖果4");
        candy.add("糖果5");
        candy.add("糖果6");
        candy.add("糖果7");
        candy.add("糖果8");
        candy.add("糖果9");
        candy.add("糖果10");
        int count = 10;
        for (int i = 1; i <= 2; i++) {
            int math = (int) (Math.random() * count);
            child1.add(candy.get(math));
            candy.remove(math);
            count--;
        }
        for (int i = 1; i < 8; i++) {
            int math = (int) (Math.random() * count);
            child2.add(candy.get(math));
            candy.remove(math);
            count--;
        }
        System.out.println("child1的糖:");
        for (int i = 0; i < child1.size(); i++) {
            System.out.println(child1.get(i));
        }
        System.out.println("child2的糖:");
        for (int i = 0; i < child2.size(); i++) {
            System.out.println(child2.get(i));
        }


    }


    public static void main(String[] args) {
        // 1.生成密钥对
        String[] generateKeyPairs = SM2Util.generateKeyPairs();
        System.out.println("私钥：" + generateKeyPairs[0]);
        System.out.println("公钥：" + generateKeyPairs[1]);
    }

}